package com.audaque.springboot.foshanupload.core.util.ssl.model;


import java.io.Serializable;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;

public class WhitelistHostnameVerifier implements HostnameVerifier, Serializable {
    private static final long serialVersionUID = 1L;
    private final String[] allowedHosts;

    public WhitelistHostnameVerifier(final String[] allowed) {
        this.allowedHosts = allowed;
    }

    public WhitelistHostnameVerifier(final String allowedList) {
        this.allowedHosts = allowedList.split(",\\s*");
    }

    public boolean verify(final String hostname, final SSLSession session) {
        String[] var3 = this.allowedHosts;
        int var4 = var3.length;

        for(int var5 = 0; var5 < var4; ++var5) {
            String allowedHost = var3[var5];
            if (hostname.equalsIgnoreCase(allowedHost)) {
                return true;
            }
        }

        return false;
    }
}
